<page-header-wrapper [title]="'合伙人账户明细'" [logo]="logo">
  <ng-template #logo>
    <!-- <button nz-button (click)="goBack()">
      <i nz-icon nzType="left" nzTheme="outline"></i>
    </button> -->
  </ng-template>
</page-header-wrapper>
<nz-card>
  <sv-container layout="vertical" [noColon]="true" col="4">
    <sv [label]="labelTpl">
      <b class="text-md ">{{headerTotalInfo?.ltdName}}</b>
    </sv>
    <sv label="可用余额">
      <span class="text-error-dark font-weight-bold">{{headerTotalInfo?.allAmount |currency}}</span>
    </sv>
    <sv label="收入金额">
      <span class="text-error-dark font-weight-bold"> {{headerTotalInfo?.incomeAmount |currency}}</span>
    </sv>
    <sv label="支出金额">
      <span class="text-error-dark font-weight-bold">{{headerTotalInfo?.payAmount |currency}}</span>
    </sv>
  </sv-container>
  <ng-template #labelTpl>
    <b class="text-md" style="color: black;">{{headerTotalInfo?.name}} &nbsp;&nbsp;{{headerTotalInfo?.phone}}</b>
  </ng-template>
</nz-card>
<nz-card>
  <div nz-row>
    <div nz-col [nzSpan]="_$expand ? 24 : 18">
      <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
    </div>
    <div nz-col [nzSpan]="_$expand ? 24 : 6" class="text-right">
      <button nz-button nzType="primary" [disabled]="!sf.valid" (click)="st?.load(1)">查询</button>
      <button nz-button (click)="resetSF()">重置</button>
      <button nz-button (click)="export()" nzType="primary"  acl  [acl-ability]="['AM-DETAIL-export']" nzGhost>导出</button>
      <button nz-button nzType="link" (click)="expandToggle()">
        {{ !_$expand ? '展开' : '收起' }}
        <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
      </button>
    </div>
  </div>
  <div class="table-content">
    <st #st [data]="service.$api_get_account_detail_page " [columns]="columns"
      [req]="{ method: 'POST', allInBody: true, reName: {pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
      [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
      [page]="{ show: true, showSize: true, pageSizes:  [5,10, 20, 50, 100, 200, 500] }"
      [loading]="service.http.loading" [scroll]="{x:'1200px'}">
      <ng-template st-row="amount" let-item>
        <div *ngIf="item.incomeType === '1'" class="text-right"> - {{item.amount | currency:' ' }}</div>
        <div *ngIf="item.incomeType === '2'" class="text-right"> + {{item.amount | currency:' ' }}</div>
      </ng-template>
      <ng-template st-row="accountBalance" let-item>
        <div class="text-right">{{item?.accountBalance |currency:' '}}</div>
      </ng-template>

    </st>
    <div class="total-footer text-md" *ngIf="st?.list?.length !== 0 ">
      合计 <label class="text-red-dark">{{ footerTotalInfo?.total }}</label> 项，收入 <label
        class="text-red-dark font-weight-bold">{{
        footerTotalInfo?.incomeAmount | currency
        }}</label>，支出 <label class="text-red-dark font-weight-bold">{{
        footerTotalInfo?.payAmount | currency }}</label>
    </div>
  </div>
</nz-card>
